package com.fstart.sys.service.impl;

import com.fstart.sys.entity.dto.PunchinDto;
import com.fstart.sys.entity.Punchin;
import com.fstart.sys.mapper.PunchinMapper;
import com.fstart.sys.service.IPunchinService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Xibing
 * @since 2023-05-05
 */
@Service
public class PunchinServiceImpl extends ServiceImpl<PunchinMapper, Punchin> implements IPunchinService {

    /**
     * 获取所有打卡信息
     * @return
     */
    @Override
    public List<PunchinDto> getAll() {
        List<PunchinDto> all = this.baseMapper.getAll();
        return all;
    }

    @Override
    public Map<String, Object>  getByPage(PunchinDto punchinDto) {
        List<PunchinDto> byPage = this.baseMapper.getByPage(punchinDto);
        Integer total = this.baseMapper.getTotal();

        Map<String, Object> data = new HashMap<>();
        data.put("punchins", byPage);
        data.put("total", total);

        return data;
    }
}
